package org.example

import org.example.proto.UserProtoBuf
import java.io.File

fun main() {
    val user = getClientPush()
    val byteData = user.toByteArray()
    println(byteData)
    val file = File("data/pb.d")
    file.delete()
    file.createNewFile()
    file.writeBytes(byteData)
}

private fun getClientPush(): UserProtoBuf.User {
    val user = UserProtoBuf.User.newBuilder()
    user.setAge(18)
    user.setTimestamp(System.currentTimeMillis())
    user.setEnabled(true)
    user.setHeight(1.88f)
    user.setWeight(66.76)
    user.setUserName("ZhaoYun")
    user.setFullAddress("CH-SC-CD")
    return user.build()
}